# coding: utf-8
from time import time
def bubble(array):
    N = len(array)
    for i in range(N-1):
        for j in range(N-i-1):
            if array[j] > array[j+1]:
                buff = array[j]
                array[j] = array[j+1]
                array[j+1] = buff
mas1 = list(map(int , open("m1_sorted.txt").read().split()))
mas2 = list(map(int , open("m2_reverse.txt").read().split()))
mas3 = list(map(int , open("m3_shuffle.txt").read().split()))

t1 = time()
bubble(mas1)
t2 = time()
print('m1_sorted', int((t2 - t1) * 1000), 'milliseconds')
t1 = time()
bubble(mas2)
t2 = time()
print('m2_reverse', int((t2 - t1) * 1000), 'milliseconds')
t1 = time()
bubble(mas3)
t2 = time()
print('m3_shuffle', int((t2 - t1) * 1000), 'milliseconds')
